]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
sessionMode: Introduce the concept of "primary" modes
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 6 Sep 2012 11:21:12 +0000 (13:21 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 6 Sep 2012 15:02:51 +0000 (17:02 +0200)
With the recent session mode changes, there is now a mix of modes
that are meant to apply to the entire session (specified as parameter
to the --mode command line switch) and temporary modes like the lock
screen; introduce a property to make the difference explicit, and only
allow "primary" modes to be specified on the command line.

https://bugzilla.gnome.org/show_bug.cgi?id=683488

js/ui/sessionMode.js

index 51fb6d615c33b811ddba91d0cd0f571eed631a32..27c81a89f423d62d300d7f70dec0862dca863a77 100644 (file)
@@ -20,6 +20,7 @@ const _modes = {
         hasWindows: false,
         isLocked: false,
         isGreeter: false,
+        isPrimary: false,
         unlockDialog: null,
         components: [],
         panel: {
@@ -32,6 +33,7 @@ const _modes = {
     'gdm': {
         allowKeybindingsWhenModal: true,
         isGreeter: true,
+        isPrimary: true,
         unlockDialog: imports.gdm.loginDialog.LoginDialog,
         components: ['polkitAgent'],
         panel: {
@@ -55,6 +57,7 @@ const _modes = {
     },
 
     'initial-setup': {
+        isPrimary: true,
         components: ['keyring'],
         panel: {
             left: [],
@@ -73,6 +76,7 @@ const _modes = {
         hasWindows: true,
         unlockDialog: imports.ui.unlockDialog.UnlockDialog,
         isLocked: false,
+        isPrimary: true,
         components: ['networkAgent', 'polkitAgent', 'telepathyClient',
                      'keyring', 'recorder', 'autorunManager', 'automountManager'],
         panel: {
@@ -87,7 +91,8 @@ const _modes = {
 function listModes() {
     let modes = Object.getOwnPropertyNames(_modes);
     for (let i = 0; i < modes.length; i++)
-        print(modes[i]);
+        if (_modes[modes[i]].isPrimary)
+            print(modes[i]);
 }
 
 const SessionMode = new Lang.Class({
@@ -95,7 +100,9 @@ const SessionMode = new Lang.Class({
 
     _init: function() {
         global.connect('notify::session-mode', Lang.bind(this, this._sync));
-        this._modeStack = [global.session_mode];
+        let mode = _modes[global.session_mode].isPrimary ? global.session_mode
+                                                         : 'user';
+        this._modeStack = [mode];
         this._sync();
     },